﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleAppDemo.PatternDemo
{
    public sealed class Singleton
    {
        private static readonly Singleton Instance = new Singleton();

        private Singleton()
        {
        }

        public static Singleton GetInstance()
        {
            return Instance;
        }
    }


    /*public class Singleton
    {
        private static Singleton _instance;
        private static object _lockObject=new object();

        public Singleton GetInstance
        {
            get
            {
                if (_instance == null)
                {
                    lock (_lockObject)
                    {
                        if (_instance==null)
                        {
                             _instance = new Singleton();
                        }
                    }
                }
                return _instance;
            }
        }
        private Singleton()
        {
        }
    }*/
}
